package com.starling.core
{
	import com.starling.utils.TextureUtil;
	
	import flash.display.DisplayObject;
	import flash.display.FrameLabel;
	import flash.display.MovieClip;
	import flash.geom.Rectangle;
	import flash.text.TextField;

	public class InfoMovieClip
	{
		public static function getInfo(mc:MovieClip ,scale:Number):Object
		{
			var childs:Array = new Array();
			var infos:Array =  new Array();
			
			
			var tempChilds:Array = new Array();
			
			for (var i:int=0;i<mc.totalFrames;i++)
			{
				var tempInfos:Array = new Array();
				
				mc.gotoAndStop(i+1);
				
				for (var j:int=0;j<mc.numChildren;j++)
				{
					var child:DisplayObject = mc.getChildAt(j);
					var childName:String = TextureUtil.getClassName(child);
					var childType:String = TextureUtil.getClassType(childName);
					if(childType == null)continue;
					
					var infoObj:Object = InfoDisplay.getInfo(child ,scale);
					infoObj.textureName = childName;
					infoObj.textureType = childType;
					
					//追加文本信息
					if(child is TextField)
					{
						infoObj.textureName = child.name;
						infoObj.textInfo = InfoTextField.getInfo(child as TextField);
					}
					
					//如果是组件则追加组件信息
					infoObj.compInfo = InfoComponents.getInfo(childType ,child);
					
					//
					if(tempChilds.indexOf(child)==-1)
					{
						var childObj:Object = new Object();
						childObj.textureType = infoObj.textureType;
						childObj.textureName = infoObj.textureName;
						if(child is TextField)
							childObj.type = (child as TextField).type;
						childs.push(childObj);
					}
					
					tempChilds.push(child);
					tempInfos.push(infoObj);
				}
				
				infos.push(tempInfos);
			}
			
			return {childs:childs ,infos:infos};
		}
	}
}